package com.sanjiahantang.youjiaclient.module.city.models;

import android.content.Context;

import com.sanjiahantang.youjiaclient.base.BaseView;
import com.sanjiahantang.youjiaclient.base.CallBack;
import com.sanjiahantang.youjiaclient.module.city.beans.CityBean;

import java.util.Comparator;

/**
 * Created by zy on 2017/9/19.
 */

public interface ICityModel {

    void loadCityList(Context context, CallBack<CityBean> callBack);


    void getAllArea(Context context, BaseView.OnLoadListener callBack);


    class CompareSort implements Comparator<CityBean.City> {

        @Override
        public int compare(CityBean.City city1, CityBean.City city2) {
            if(city1.getPinyin().equals("@") || city2.getPinyin().equals("@")){
                //通讯录前面的ｉｔｅｍ(公众号，标签......)
                return city1.getPinyin().equals("@") ? -1:1;
            }
            //user1属于#标签，放到后面
            else if(!city1.getPinyin().matches("[A-z]+")){
                return 1;
                //user2属于#标签，放到后面
            }else if(!city2.getPinyin().matches("[A-z]+")){
                return -1;
            }else {
                return city1.getPinyin().compareTo(city2.getPinyin());
            }
        }
    }
}
